package com.zhigh.calcite.startproject.func;

import org.apache.calcite.schema.Function;
import org.apache.calcite.schema.impl.AggregateFunctionImpl;

public interface AggregateFunction<T, V, E, R> {
    T init();

    T add(T aggregateObj, V value, E extra);

    R result(T aggregateObj);

    static <O extends AggregateFunction<?, ?, ?, ?>> Function create(Class<O> cls) {
        return AggregateFunctionImpl.create(cls);
    }
}
